import {ref} from "vue"
export const TABLE_PROVIDE_KEY = Symbol()

export const use_TABLE_CONFIG = function(){
    const TABLE_CONFIG = ref({
        columns: new Map(),
        setColumn,
        delColumn
    })

    function setColumn(key: Symbol, value: any): void {
        TABLE_CONFIG.value.columns.set(
            key, 
            Object.assign(TABLE_CONFIG.value.columns.get(key) ?? {}, value)
        )
    }
    function delColumn (key: Symbol): void {
        TABLE_CONFIG.value.columns.delete(key)
    }

    return TABLE_CONFIG
}